package com.haidechizi.demo.web;

import com.alibaba.fastjson.JSON;
import com.haidechizi.demo.entity.Student;
import com.haidechizi.demo.enums.CourseTypeEnum;
import com.haidechizi.demo.service.StudentService;
import com.haidechizi.i18n.common.utils.I18nUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


//@Slf4j
@RestController
@RequestMapping
public class IndexController {

    private static final String welcome = "welcome";

    @Autowired
    private StudentService studentService;

    @RequestMapping
    public String index() {
        String translate = I18nUtils.translate(welcome);

        String name = I18nUtils.translateForEnum(CourseTypeEnum.CHINESE);

//        log.info("translate: {}, name : {}", translate, name);
        Student student = studentService.saveStudent();
        return JSON.toJSONString(student);
    }
}
